package com.herewego;

import android.app.Activity;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.view.Gravity;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.WindowManager;
import android.view.WindowManager.LayoutParams;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

public class Home extends Activity {
	LinearLayout lin;

	private final int MENU_ITEM_0 = 0;  
	private final int MENU_ITEM_1 = 1;  
	private final int MENU_ITEM_2 = 2;  
	private final int MENU_ITEM_3 = 3;  
	private final int MENU_ITEM_4 = 4;  

	public boolean onCreateOptionsMenu(Menu menu) {  

	    menu.add(0, MENU_ITEM_0, 0, "Home").setIcon(R.drawable.tabhome2x);  
	    menu.add(0, MENU_ITEM_1, 0, "Mi viaje").setIcon(R.drawable.tabmiviaje2x);  
	    menu.add(0, MENU_ITEM_2, 0, "Configuración").setIcon(R.drawable.tabajustes2x);  
	    menu.add(0, MENU_ITEM_3, 0, "Camara").setIcon(R.drawable.tabcamara2x);  
	    menu.add(0, MENU_ITEM_4, 0, "Modo").setIcon(R.drawable.tabmodo2x);  
	    return true;  
	}  
	 

	public boolean onOptionsItemSelected(MenuItem item) {  
	    switch (item.getItemId()) {  
	        case MENU_ITEM_0:  
	        	// put your code here 
	        	break;
	        case MENU_ITEM_1: 
	    		Intent goviaje=new Intent(Home.this, Viaje.class);
	    		startActivity(goviaje);
	        	break;
	        case MENU_ITEM_2:  
	    		Intent goconfig=new Intent(Home.this, Configuracion.class);
	    		startActivity(goconfig);
	        	break;
	        case MENU_ITEM_3: 
	    		Intent gocam=new Intent(Home.this, Camara.class);
	    		startActivity(gocam);	        	
	    		break;
	        case MENU_ITEM_4:  
	    		Intent gomodo=new Intent(Home.this, Modo.class);
	    		startActivity(gomodo);

		  default:
	    }  
	    return false;  
	}
	
	
	
	@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.home);
        this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);

        Button btnmapa=(Button) findViewById(R.id.mapa);
        btnmapa.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View arg0) {
				Intent goMapa=new Intent(Home.this, Mapa.class);
				startActivity(goMapa);
//				finish();
				
			}
		});
        
        
        
        
        lin=(LinearLayout) findViewById(R.id.linearLayout1);
     ImageView audio=(ImageView) findViewById(R.id.audioboton);
        audio.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				LinearLayout audiolayout=new LinearLayout(getApplicationContext());
				audiolayout.setOrientation(0);
				audiolayout.setLayoutParams(new LayoutParams(android.view.ViewGroup.LayoutParams.FILL_PARENT, android.view.ViewGroup.LayoutParams.WRAP_CONTENT));
				LinearLayout botoneslayout=new LinearLayout(getApplicationContext());
				botoneslayout.setOrientation(0);
				botoneslayout.setLayoutParams(new LayoutParams(android.view.ViewGroup.LayoutParams.FILL_PARENT, android.view.ViewGroup.LayoutParams.WRAP_CONTENT));

				
				TextView labelaudio=new TextView(getApplicationContext());
				labelaudio.setText("Audio actual: ");

				Button play=new Button(getApplicationContext());
				play.setBackgroundResource(R.drawable.play);
				
				Button pause=new Button(getApplicationContext());
				pause.setBackgroundResource(R.drawable.pause);
				Button stop=new Button(getApplicationContext());
				stop.setBackgroundResource(R.drawable.stop);
				
				botoneslayout.addView(play);
				botoneslayout.addView(pause);
				botoneslayout.addView(stop);
				
				audiolayout.addView(labelaudio);
				audiolayout.addView(botoneslayout);

				
				lin.addView(audiolayout,1);
				
			}
		});
        
       
    }
}









